<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
<style type="text/css">
    .btn {margin-bottom: 15px;}
    .tools-nav .btn {padding-top: 20px;  padding-bottom: 20px;}
</style>
<a href="<?php  echo $this->createWebUrl('myapp');?>" class="btn btn-primary"> <i class="fa fa-reply-all"></i> 我的应用</a>
<div class="panel panel-default row">
    <div class="panel-heading"><?php  echo $app['appname'];?> 管理</div>
    <div class="panel-body" style="margin: 0 -15px">
        <div class="col-sm-3">
            <div class="thumbnail">
                <img src="<?php  echo tomedia($app['icon'])?>" alt="<?php  echo $app['appname'];?>" style="width:100%">
            </div>
        </div>
        <div class="col-sm-8">
            <div class="row" style="margin-bottom: 15px;">
            <?php $applink = $_W['siteroot'].'app/index.php?i='.$_W['uniacid'].'&c=entry&appid='.$app['id'].'&do=preview&m=zht_app';?>
                <p>名称：<?php  echo $app['appname'];?></p>
                <p>摘要：<?php  echo $app['description'];?></p>
                <p>地址：<a href="<?php  echo $applink;?>" target="_blank"><?php  echo $applink;?></a></p>
                <p>访问：<?php  echo $app['onclick'];?></p>
            </div>
            <div class="tools-nav" style="margin: 0 -15px 15px;">
                <div class="col-sm-4">
                    <a href="<?php  echo $this->createWebUrl('factory',array('op'=>'editapp', 'appid'=>$app['id']));?>" class="btn btn-default btn-block btn-lg" target="_blank"><i class="glyphicon glyphicon-cog"></i> 应用信息</a>
                </div>
                <div class="col-sm-4">
                    <a href="<?php  echo $this->createWebUrl('factory',array('op'=>'work', 'appid'=>$app['id']));?>" class="btn btn-default btn-block btn-lg" target="_blank"><i class="glyphicon glyphicon-road"></i> 页面制作</a>
                </div> 
                <!-- <div class="col-sm-4">
                    <a href="" class="btn btn-default btn-block btn-lg"><i class="glyphicon glyphicon-cog"></i> 数据统计</a>
                </div>  -->
                <div class="col-sm-4">
                <?php  if($app['status']==0) { ?>
                    <a href="javascript:;" data-app-id="<?php  echo $app['id'];?>" onclick="QIYUE.publish(this, 1)" class="btn btn-default btn-block btn-lg"><i class="glyphicon glyphicon-play"></i> 页面发布</a>
                <?php  } else { ?>
                    <a href="javascript:;" data-app-id="<?php  echo $app['id'];?>" onclick="QIYUE.publish(this, 0)" class="btn btn-default btn-block btn-lg"><span class="text-danger"><i class="glyphicon glyphicon-stop"></i> 应用下架</span></a>
                <?php  } ?>
                </div>
                <!-- <div class="col-sm-4">
                    <a href="" class="btn btn-default btn-block btn-lg"><i class="glyphicon glyphicon-qrcode"></i> 二维码设置</a>
                </div> -->
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var QIYUE = {
        jsonUrl: "<?php  echo $this->createWebUrl('factory')?>",
        publish: function(_this, status){
            var appid = $(_this).attr('data-app-id');
            if(!appid) return false;
            $.post(this.jsonUrl, {"op":"publish","appid":appid,"status":status}, function(msg){
                $(_this).text('正在提交…');
                var _obj = JSON.parse(msg);
                if(_obj.message.state==0){
                    location.reload();
                }
            });
        }
    }
</script>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>